package main

import (
	"flag"
	"runtime"
	"tcp_server/conf"
	"tcp_server/server"
)

func main() {
	// 开启多核处理
	runtime.GOMAXPROCS(runtime.NumCPU())
	// 设置命令行参数解析
	var (
		configPath = flag.String("config", "config.json", "json config file location")      // 配置类文件路径
		pubKeyPath = flag.String("pub", "conf/public.pem", "the file path of public.pem")   // 公钥文件路径
		priKeyPath = flag.String("pri", "conf/private.pem", "the file path of private.pem") // 私钥文件路径
	)
	flag.Parse()

	// 初始化配置
	conf.InitJsonConfig(configPath, pubKeyPath, priKeyPath)
	// 开始监听
	server.ListenServer()
}
